<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue 生命周期函数</title>
</head>
<body>
  <div id="root"></div>
  <script src="https://unpkg.com/vue@next"></script>

  <script>
    const app = Vue.createApp({
      data() {
        return {
          message: 'hello vue'
        }
      },
      methods: {
        onClick() {
          alert('click');
        }
      },

      beforeCreate() {
        console.log('before create');
      },

      created() {
        console.log('created');
      },

      beforeMount() {
        console.log('before mount');
      },

      mounted() {
        console.log('mounted');
      },


      
      template: '<div v-on:click="onClick">{{ message }}</div>'

    });

    const vm = app.mount('#root');
  </script>



</body>
</html>